<template>
    <div>
        
    </div>
</template>


<script>
export default {
    created(){
//从浏览器的缓存中。获取登录名和密码
   let loginId = localStorage.getItem('loginId')
   let loginPwd = localStorage.getItem('loginPwd')
   if(!loginId ||!loginPwd){
     this.$router.push('/login')  
   }else{
let {success,token} = this.$get   //await
   ('/Admin/Login',
   {
    loginId,
     loginPwd

   });
   if (success){
       sessionStorage.setItem("token",token);
       this.$setToken();
       this.$router.push("/layout");
   }else{
//跳转到登录页面
this.$router.push('/login')

   }
       
   }

   
   },
    
};
</script>

<style scoped lang="scss">
    
</style>

